import http from "../utils/http";

export const getChannelAPI = () => {
  return http({
    url: "/channels",
  });
};

// 新增
export const publishAPI = (data) => {
  return http({
    url: "/mp/articles?draft=false",
    method: "POST",
    data,
  });
};

// 编辑
export const editAPI = (data) => {
  return http({
    url: `/mp/articles/${data.id}?draft=false`,
    method: "PUT",
    data,
  });
};

export const getArticleListAPI = (params) => {
  return http({
    url: "/mp/articles",
    params,
  });
};

export const deleteArticleListAPI = (data) => {
  return http({
    url: `/mp/articles/${data.id}`,
    method: "DELETE",
  });
};

export const getArticleAPI = (data) => {
  return http({
    url: `/mp/articles/${data.id}`,
  });
};
